package com.coolbi.onsupai.admin.action;

import java.io.File;

import org.apache.struts2.ServletActionContext;

import com.coolbi.common.util.ImageUtil;
import com.coolbi.security.web.action.SessionAction;

public class TestAction extends SessionAction {

	private static final long serialVersionUID = 1L;

	private String usernames;
	private String realnames;
	private File upload;
	
	public String submit() {
		try {
			System.out.println(usernames);
			System.out.println(realnames);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}

	public String upload() {
		String destImagePath = null;
		try {
			destImagePath = ImageUtil.copyImageFile(ServletActionContext.getServletContext(), upload, null, "/upload");
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("destImagePath------->" + destImagePath);
		return SUCCESS;
	}
	
	public String getUsernames() {
		return usernames;
	}

	public void setUsernames(String usernames) {
		this.usernames = usernames;
	}

	public String getRealnames() {
		return realnames;
	}

	public void setRealnames(String realnames) {
		this.realnames = realnames;
	}

	public File getUpload() {
		return upload;
	}

	public void setUpload(File upload) {
		this.upload = upload;
	}
}
